package com.ruoyi.system.domain;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.FileObject;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.typehandler.FileObjectTypeHandler;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Transient;

import java.util.ArrayList;
import java.util.List;

/**
 * 文件管理对象 t_file
 * 
 * @author wp
 * @date 2023-08-10
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@Accessors(chain = true)
@TableName(value = "t_file", autoResultMap = true, excludeProperty = {"updateTime", "updateBy"})
public class File extends BaseEntity {

    /** 唯一主键 */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty("文件名称")
    private String fileName;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty("上传类型（0:mcu;1:app;2:系统固件）")
    private Integer uploadType;

    /** 文件地址 */
    @TableField(typeHandler = FileObjectTypeHandler.class)
    private List<FileObject> fileAddress;

    @ApiModelProperty("上传人")
    @TableField(exist = false)
    @Transient
    private String createUserName;
}
